
#ifndef _APDU_LIB_PIN_MGR_H_
#define _APDU_LIB_PIN_MGR_H_

#include "../apdu.def/apdu_datatypes.h"

#ifdef __cplusplus
extern "C" {
#endif

	int app_get_pin_info(HANDLE devHandle, int pin_type, int app_id, int * max_retry, 
			int * left_times, int * state);

	int app_change_pin( HANDLE devHandle, unsigned char random[16], 
			int pin_type, int app_id, char * old_pin, char * new_pin );

	int app_verify_pin(HANDLE devHandle,  unsigned char random[16],  
			int pin_type, int app_id, char * pin);

	
	int app_unblock_pin(HANDLE devHandle, unsigned char random[16], 
			int app_id, char * admin_pin, char * user_pin);

	int app_reload_pin(HANDLE devHandle, unsigned char random[16], 
			int app_id, char * user_pin);

	int app_remote_unblock_pin( HANDLE devHandle, int app_id, unsigned char cipher[20], int cipher_len);
	
	int app_clear_secure_state(HANDLE devHandle, int app_id);
	
	int app_clear_secure_state_ex( HANDLE devHandle, int app_id, int mode );

	int app_verify_pin_ms(HANDLE devHandle, int app_id, int pin_type, unsigned char * acknowlege, int ack_len);

	int app_unblock_pin_ms(HANDLE devHandle, int app_id,unsigned char * acknowlege, int ack_len, char * user_pin);

	int app_change_pin_ms( HANDLE devHandle, int app_id, int pin_type, unsigned char * acknowlege, int ack_len, unsigned char * new_pin, int new_pin_len);

	unsigned char* app_sm_encrypt(unsigned char key[16], unsigned char * input, int input_len, int * out_len );



#ifdef __cplusplus
}
#endif

#endif
